import { defineStore } from "pinia";

export interface IList {
  pagePath: string;
  iconPath: string;
  selectedIconPath: string;
  text?: string;
  background?: string;
  idx: number;
}

interface ITabBar {
  current: number;
  list: IList[];
}

export const useTabBar = defineStore({
  id: "tab-bar",
  state: (): ITabBar => ({
    current: 0,
    list: [],
  }),
  getters: {
    getCurrent(): number {
      return this.current;
    },
    getList(): IList[] {
      return this.list;
    },
  },
  actions: {
    setCurrent(idx: number) {
      this.current = idx;
    },
    setList(list: IList[]) {
      this.list = list;
    },
  },
});
